#include <iostream>
#include <cinttypes>
#include <boost/asio.hpp>
#include <boost/bind.hpp>

using namespace std;

int main(int argc, char* argv[])
{
    try
    {
        boost::asio::io_service io;
        boost::asio::serial_port sp(io, "/dev/ttyUSB2");

        sp.set_option(boost::asio::serial_port::baud_rate(921600));
        sp.set_option(boost::asio::serial_port::flow_control());
        sp.set_option(boost::asio::serial_port::parity());
        sp.set_option(boost::asio::serial_port::stop_bits());
        sp.set_option(boost::asio::serial_port::character_size(8));
        char buf[150];
        boost::system::error_code err;
        while (true)
        {
            size_t ret = sp.read_some(boost::asio::buffer(buf, 150), err);
            for(int i=0;i<120;i++){
                if((uint16_t)buf[i]==0x55){
                    cout<<endl;
                    while(i+11<120){
                        for(int p=0;p<11;p++)
                            cout<<hex<<showbase<<(uint16_t)buf[i+p]<<" ";
                        i=i+11;
                        cout<<endl;
                    }
                }
            }
        }

        io.run();
    }
    catch (exception& err)
    {
        cout << "Exception Error: " << err.what() << endl;
    }


    getchar();
    return 0;
}
